package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.ManageMapper;
import com.example.pojo.Manage;
import com.example.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManageServiceImpl extends ServiceImpl<ManageMapper, Manage> implements ManageService {
    @Autowired
    private ManageMapper manageMapper;

    @Override
    public Manage login(Manage manage) {
        QueryWrapper<Manage> wrapper = new QueryWrapper<>();
        wrapper.eq("account", manage.getAccount());
        return manageMapper.selectOne(wrapper);
    }

    @Override
    public List<Manage> selectAllManage(String manager,int start, int pageSize) {
        return manageMapper.selectAllManage(manager,start, pageSize);
    }

    @Override
    public int selectManageCount(String manager) {
        return manageMapper.selectManageCount(manager);
    }

    @Override
    public int updateManage(Manage manage) {
        return manageMapper.updateById(manage);
    }

    @Override
    public int deleteManage(Integer id) {
        return manageMapper.deleteById(id);
    }

    @Override
    public int addManage(Manage manage) {
        return manageMapper.insert(manage);
    }

    @Override
    public Manage selectManageById(Integer id) {
        return manageMapper.selectById(id);
    }
}
